subroutine init2d(a,i,i_vertex2D,i_nVer2D,i_nInCat2D,i_igT,i_jgT,i_ggT,i_ig,&
    i_jg,i_ggl,i_ggu,i_di,i_f,i_v1,i_v2,i_v3,i_v4,i_v5,i_ggl2,i_ggu2,i_di2,&
    i_Hfi,i_l1,i_numbersEl,i_params)
    dimension a(100000000),i(100000000)
    real*8 a,eps2d,eps3d,radiusRED
    integer rz_dat,tsize_dat,gg_dat,elemsCount2D,typeTask,typeTask_txt,sigma_txt
    common /files_task2d/inf2tr_dat,nvkat2d_dat,rz_dat,nvtr_dat,tsize_dat,ig_dat,&
    jg_dat,gg_dat,l1_dat,sigma_txt
    common /commonInfo/ eps2d,eps3d,radiusRED,maxiter,typeTask,nt,nMaterials
    common /commonIndex/ indexI,indexA
    common /dimTask2D/ nodesCount2D,elemsCount2D,nodesBoundCount2D,nodesTermCount2D,&
    m2D,mTerm2d,nodesNotTermCount2D,nMaterials2d
    common /files_common/ infite_0,num_slae,log_txt,typeTask_txt

    call open_files_init2d()

    !input 2D data
101 format(' ISLAU=',i8,' INDKU1=',i8,' INDFPO=',i8)
102 format('KUZLOV=',i8,'    KPAR=',i8,'    KT1=',i8,'    KT2=',i8,'    KT3=',i8)
103 format('KISRS1=',i8,' KISRS2=',i8,' KISRS3=',i8,'   KBRS=',i8)
104 format('KREB4 =',i8,' KTSIM =',i8)
    read(inf2tr_dat,101)k,k,k
    read(inf2tr_dat,102) nodesCount2D,elemsCount2D,nodesBoundCount2D,k1,k2
    read(inf2tr_dat,103) k,k,k,k
    read(inf2tr_dat,104) kreb4,k
    read(tsize_dat,*)nodesTermCount2D
    nodesNotTermCount2D = nodesCount2D-nodesTermCount2D

    i_params   = indexA
    call inputParams_task2d(a(i_params),sigma_txt,nMaterials2d)
    i_vertex2D = i_params+nMaterials2d
    i_ggT      = i_vertex2D+2*nodesCount2D
    i_nVer2D   = indexI
    i_nInCat2D = i_nVer2D+4*elemsCount2D
    i_l1       = i_nInCat2D+elemsCount2D
    i_numbersEl= i_l1+nodesBoundCount2D
    i_igT      = i_numbersEl+4*nodesCount2D
    i_jgT      = i_igT+nodesTermCount2D+1
    call inputForTask2d(a(i_vertex2D),i(i_nVer2D),i(i_nInCat2D),i(i_igT),&
    i(i_jgT),a(i_ggT),i(i_l1),i(i_numbersEl))
    i_listbeg = i_jgT+mTerm2d
    i_ig      = i_listbeg+nodesNotTermCount2D
    i_jg      = i_ig+nodesNotTermCount2D+1
    call portrait(i(i_ig),i(i_jg),nodesCount2D,elemsCount2D,i(i_nVer2D),m2d,&
    i(i_listbeg),4,4,i(i_igT),i(i_jgT),mTerm2d,nodesNotTermCount2D)
    i_ggl     = i_ggT+mTerm2d
    i_ggu     = i_ggl+m2d
    i_di      = i_ggu+m2d
    i_f       = i_di+nodesNotTermCount2D
    i_v1      = i_f+nodesNotTermCount2D
    i_v2      = i_v1+nodesNotTermCount2D
    i_v3      = i_v2+nodesNotTermCount2D
    i_v4      = i_v3+nodesNotTermCount2D
    i_v5      = i_v4+nodesNotTermCount2D
    i_ggl2    = i_v5+nodesNotTermCount2D
    i_ggu2    = i_ggl2+m2d
    i_di2     = i_ggu2+m2d
    i_Hfi     = i_di2+nodesNotTermCount2D

1   format(A,i8,' nElement =',i8)
    write(*,1)'SP: task2d:            nVertex =',nodesCount2D,elemsCount2D
    write(log_txt,1)'SP: task2d:            nVertex =',nodesCount2D,elemsCount2D
end
!*************************************************************************
subroutine open_files_init2d()
    common /files_task2d/inf2tr_dat,nvkat2d_dat,rz_dat,nvtr_dat,tsize_dat,&
    ig_dat,jg_dat,gg_dat,l1_dat,sigma_txt
    integer rz_dat,tsize_dat,gg_dat,sigma_txt
    inf2tr_dat  = 101
    nvkat2d_dat = 102
    rz_dat      = 103
    nvtr_dat    = 104
    tsize_dat   = 105
    ig_dat      = 106
    jg_dat      = 107
    gg_dat      = 108
    l1_dat      = 109
    sigma_txt = 110
    open(inf2tr_dat,file='.\calculations\mesh2dHfi\inf2tr.dat',mode='read')
    open(nvkat2d_dat,file='.\calculations\mesh2dHfi\nvkat2d.dat',access='direct',recl=4,mode='read')
    open(rz_dat,file='.\calculations\mesh2dHfi\rz.dat',access='direct',recl=16,mode='read')
    open(nvtr_dat,file='.\calculations\mesh2dHfi\nvtr.dat',access='direct',recl=24,mode='read')
    open(tsize_dat,file='.\calculations\mesh2dHfi\tsize.dat',mode='read')
    open(ig_dat,file='.\calculations\mesh2dHfi\ig.dat',access='direct',recl=4,mode='read')
    open(jg_dat,file='.\calculations\mesh2dHfi\jg.dat',access='direct',recl=4,mode='read')
    open(gg_dat,file='.\calculations\mesh2dHfi\gg.dat',access='direct',recl=8,mode='read')
    open(l1_dat,file='.\calculations\mesh2dHfi\l1.dat',access='direct',recl=4,mode='read')
    open(sigma_txt,file='.\calculations\mesh2dHfi\sigma',mode='read')

end
!*************************************************************************
subroutine inputForTask2d(vertex,nVer,nInCat2D,igT,jgT,ggT,l1,numbersEl)
    common /files_task2d/inf2tr_dat,nvkat2d_dat,rz_dat,nvtr_dat,tsize_dat,&
    ig_dat,jg_dat,gg_dat,l1_dat,sigma_txt
    common /dimTask2D/nodesCount2D,elemsCount2D,nodesBoundCount2D,nodesTermCount2D,&
    m2D,mTerm2d,nodesNotTermCount2D,nMaterials2d
    common /boundaryTask2D/maxR,maxZ,minR,minZ
    integer rz_dat,tsize_dat,gg_dat,points_txt,sigma_txt
    integer elemsCount2D
    real*8 vertex,ggT,maxR,maxZ,minR,minZ
    dimension vertex(2,nodesCount2D),nVer(4,elemsCount2D),nInCat2D(elemsCount2D),&
    igT(nodesTermCount2D+1),jgT(*),ggT(*),l1(nodesBoundCount2D),&
    numbersEl(4,nodesCount2D)

    call readMesh2D(rz_dat,nvkat2D_dat,nvtr_dat,l1_dat,vertex,nInCat2D,nVer,l1,&
    nodesCount2D,elemsCount2D,nodesBoundCount2D,minR,maxR,minZ,maxZ)
    call readMatrixT(ig_dat,jg_dat,gg_dat,igT,jgT,ggT,nodesTermCount2D,mTerm2d)
    call getNumbersElementForVertex2D(nVer,numbersEl,elemsCount2D,nodesCount2D)
end
!*************************************************************************
!*************************************************************************
!*************************************************************************